package com.example.test.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.test.domain.User;

import java.util.ArrayList;
import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;

@RestController
@RequestMapping("/user")
public class UserControll {

	@GetMapping
	public List<User> findAll() {
		List<User> users = new ArrayList<>();
		User user = new User();
		user.setId("1");
		user.setName("南京");
		user.setAge(18);
		users.add(user);
		return users;
	}

	@GetMapping("/{id}")
	public User getUserInfo(String id) {
		User user = new User();
		user.setId("2");
		user.setName("上海");
		user.setAge(18);
		return user;
	}

}
